package com.qf.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.qf.pojo.Books;
import com.qf.service.IBooksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BooksController {
    private IBooksService booksService;

    @Autowired
    public void setBooksService(IBooksService booksService) {
        this.booksService = booksService;
    }

    @GetMapping("/books")
    public List<Books> findAll() throws JsonProcessingException {
        System.out.println("来查书了");
      return   booksService.findAll();
    }
}
